package edu.uic.cs.i422.s2011.team4;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;

public class Form extends Activity implements OnClickListener {
    /** Called when the activity is first created. */
	Button predatorButton;
	Button feedingButton;
	Button treeButton;
	Button settingButton;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        /**
         * Create our Activity layout container
         */
        LinearLayout container = new LinearLayout(this);
        container.setOrientation(LinearLayout.VERTICAL);
        container.setGravity(Gravity.CENTER);
        
        /**
         * Make a button and add click listener
         */
        predatorButton = new Button(this);
        predatorButton.setGravity(Gravity.CENTER);
        predatorButton.setText("Predators");
        predatorButton.setOnClickListener(this);
        
        /**
         * Add the button to the container
         */
        container.addView(predatorButton);
        /**
         * Make a button and add click listener
         */
        feedingButton = new Button(this);
        feedingButton.setGravity(Gravity.CENTER);
        feedingButton.setText("Food");
        feedingButton.setOnClickListener(this);
        
        container.addView(feedingButton);    
        
        treeButton = new Button(this);
        treeButton.setGravity(Gravity.CENTER);
        treeButton.setText("Tree");
        treeButton.setOnClickListener(this);        
        /**
         * Add the button to the container
         */
        container.addView(treeButton);
        
        settingButton = new Button(this);
        settingButton.setGravity(Gravity.CENTER);
        settingButton.setText("Setting");
        settingButton.setOnClickListener(this);        
        /**
         * Add the button to the container
         */
        container.addView(settingButton);
        
        
        /**
         * Display our container
         */
        setContentView(container);
    }
    
    public void onClick(View v) {
    	/**
    	 * Create new intent and call our class!
    	 */
    	Intent myIntent;
    	if(v==predatorButton)
    	myIntent= new Intent(v.getContext(), PredatorObservation.class);
    	else if (v==feedingButton)
        	myIntent= new Intent(v.getContext(), FeedingObservation.class);
    	else if (v==treeButton)
        	myIntent= new Intent(v.getContext(), TreeObservation.class);
    	else if (v==settingButton)
    		myIntent= new Intent(v.getContext(), SettingObservation.class);
    	else
    		myIntent= new Intent(v.getContext(), SliderTrees.class);
    	
        startActivityForResult(myIntent, 0);
    }
}